import { GComponent } from "./GComponent";
import { UIObjectFactory } from "./UIObjectFactory";

type Cls = new () => GComponent;
export class UIBinder {
    private _extensions :Map<string, Cls>;
    constructor() {
        this._extensions = new Map();
    }

    public register(url: string, cls: Cls): void {
        this._extensions.set(url, cls);
    }

    public bindAll(): void {
        for (const kv of this._extensions) {
            UIObjectFactory.setExtension(kv[0], kv[1]);
        }
    }
}